package com.spi.soconversion.orders.conversion;

import com.spi.soconversion.util.SOCConstants;
import com.spi.soconversion.util.SOCUtility;
import com.spi.soconversion.util.XMLAttributeConstants;
import com.spi.soconversion.util.XMLTagConstants;

public class ItemInstallBase extends InstallBase{
	private InstallBaseAssociation ibAssociation = new InstallBaseAssociation();
	private InstallBaseNotes ibNotes = new InstallBaseNotes();
	
	public void setInstallBaseAssociation(InstallBaseAssociation ibAssociation) {
		this.ibAssociation = ibAssociation;
	}
	
	public InstallBaseAssociation getInstallBaseAssociation() {
		return ibAssociation;
	}
	
	public void setInstallBaseNotes(InstallBaseNotes ibNotes) {
		this.ibNotes = ibNotes;
	}
	
	public InstallBaseNotes getInstallBaseNotes() {
		return ibNotes;
	}
	
	@Override
	public String toString()
	{
		StringBuilder sb = new StringBuilder();
		
		sb.append(XMLTagConstants.START_TAG_HBC_INSTALL_BASE);
		sb.append(SOCConstants.BLANK_STRING);
		
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ADD_LINE1,  SOCUtility.replaceXMLSpecialCharacters(getAddLine1()) ));
		sb.append(SOCConstants.BLANK_STRING);
		
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ADD_LINE2, SOCUtility.replaceXMLSpecialCharacters(getAddLine2())));
		sb.append(SOCConstants.BLANK_STRING);
		
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ADD_LINE3,  SOCUtility.replaceXMLSpecialCharacters(getAddLine3())));
		sb.append(SOCConstants.BLANK_STRING);
		
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ADD_LINE4,  SOCUtility.replaceXMLSpecialCharacters(getAddLine4())));
		sb.append(SOCConstants.BLANK_STRING);
		
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ADD_LINE5,  SOCUtility.replaceXMLSpecialCharacters(getAddLine5())));
		sb.append(SOCConstants.BLANK_STRING);
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.CITY, SOCUtility.replaceXMLSpecialCharacters(getCity())));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.STATE,  SOCUtility.replaceXMLSpecialCharacters(getState())));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ZIP_CODE, SOCUtility.replaceXMLSpecialCharacters(getZipCode())));
				
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.CREATE_PROG_ID, getCreateProgID()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.CREATE_TS, getCreatets()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.CREATE_USER_ID,  SOCUtility.replaceXMLSpecialCharacters(getCreateUserID())));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.CUSTOMER_ID, getCustomerID()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.MOBILE_NO, getMobile()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.DAY_FAX_NO, getDayFax()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.DAY_PHONE_NO, getDayPhone()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.EMAIL_ID,  SOCUtility.replaceXMLSpecialCharacters(getEmailID())));
				
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.EVENING_FAX_N0,getEveFax()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.EVENING_PHONE,getEvePhone()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ENTERPRISE_CODE, getEnterpriseCode()));
						
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.FIRST_NAME,  SOCUtility.replaceXMLSpecialCharacters(getFirstName())));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.LAST_NAME,  SOCUtility.replaceXMLSpecialCharacters(getLastName())));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.FULLFILLMENT_DATE,getFulFillmentDate()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.FULLFILLMENT_METHOD, getFulFillmentMethod()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.FULLFILLMENT_STORE, getFulFillmentStore()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.INSTALL_BASE_KEY, getInstallBaseKey()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ITEM_DESCRIPTION,  SOCUtility.replaceXMLSpecialCharacters(getItemDesc())));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ITEM_ID, getItemID()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ITEM_TYPE, getItemType()));				
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.LIFE_EXPECTANCY, getLifeExpectancy()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.LINE_TYPE, getLineType()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.LOCK_ID, getLockID()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.MODIFY_PROGID, getModifyProgID()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.MODIFY_TS,getModifyts()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.MODIFY_USER_ID, getModifyUserID()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ORDER_HEADER_KEY, getOrderHeaderKey()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ORDER_LINE_KEY, getOrderLineKey()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.ORDER_NUM, getOrderNo()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.POS_REGISTER_ID, getPosRegister()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.POS_TRANS_DATE, getPosTransDate()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.POS_TRANS_ID, getPosTransID()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.QUANTITY, getQuantity()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.SELLING_PRICE,getSellingPrice()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.SELLING_STORE,getSellingStore()));					
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.MANUFACTURES_END_DATE, getManuEndDate()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.MANUFACTURES_START_DATE,getManuStartDate()));
		
		sb.append(SOCConstants.BLANK_STRING);
		sb.append(SOCUtility.getAttribute(XMLAttributeConstants.WARRANTY_DURATION, getWarrantyDuration()));
				
		sb.append(SOCConstants.CLOSING_XML_TAG);
		
		String ibAssoc=getInstallBaseAssociation().toString();
		if(ibAssoc.length()>0)
		{
			sb.append(SOCConstants.NEW_LINE);
			sb.append(ibAssoc);
		}
		String ibNotes=getInstallBaseNotes().toString();
		if(ibNotes.length()>0)
		{
			sb.append(SOCConstants.NEW_LINE);
			sb.append(ibNotes);
		}
		sb.append(SOCConstants.NEW_LINE);
		sb.append(XMLTagConstants.END_TAG_HBC_INSTALL_BASE);
		return sb.toString();
	}
}
